﻿using B.S.BasicData.Api.Read.Application.Command.Log;
using B.S.BasicData.Api.Read.Dtos;
using B.S.BasicData.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BasicData.Api.Read.Controllers
{
    /// <summary>
    /// 日志控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LogController : ControllerBase
    {
        private readonly IMediator mediator;

        public LogController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 日志的分页接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public Task<ApiPaging<LogDto>> GetLogPage([FromQuery]GetLogCommand request)
        {
            return mediator.Send(request);
        }
    }
}
